home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Developer Essentials / MPW Interfaces & Libraries / PInterfaces / Connections.p < prev    next >
Encoding:
Text File  |  1992-01-29  |  7.8 KB  |  297 lines  |  [TEXT/MPS ]

  1.  
  2. {
  3. Created: Wednesday, September 11, 1991 at 11:34 AM
  4.  Connections.p
  5.  Pascal Interface to the Macintosh Libraries
  6.  
  7.   Copyright Apple Computer, Inc. 1988-1991
  8.   All rights reserved
  9. }
  10.  
  11.  
  12. {$IFC UNDEFINED UsingIncludes}
  13. {$SETC UsingIncludes := 0}
  14. {$ENDC}
  15.  
  16. {$IFC NOT UsingIncludes}
  17.  UNIT Connections;
  18.  INTERFACE
  19. {$ENDC}
  20.  
  21. {$IFC UNDEFINED UsingConnections}
  22. {$SETC UsingConnections := 1}
  23.  
  24. {$I+}
  25. {$SETC ConnectionsIncludes := UsingIncludes}
  26. {$SETC UsingIncludes := 1}
  27. {$IFC UNDEFINED UsingDialogs}
  28. {$I $$Shell(PInterfaces)Dialogs.p}
  29. {$ENDC}
  30. {$IFC UNDEFINED UsingCTBUtilities}
  31. {$I $$Shell(PInterfaces)CTBUtilities.p}
  32. {$ENDC}
  33. {$SETC UsingIncludes := ConnectionsIncludes}
  34.  
  35. CONST
  36.  
  37. {    current Connection Manager version    }
  38. curCMVersion = 2;
  39.  
  40. {    current Connection Manager Environment Record version     }
  41. curConnEnvRecVers = 0;
  42.  
  43. { CMErr }
  44. cmGenericError = -1;
  45. cmNoErr = 0;
  46. cmRejected = 1;
  47. cmFailed = 2;
  48. cmTimeOut = 3;
  49. cmNotOpen = 4;
  50. cmNotClosed = 5;
  51. cmNoRequestPending = 6;
  52. cmNotSupported = 7;
  53. cmNoTools = 8;
  54. cmUserCancel = 9;
  55. cmUnknownError = 11;
  56.  
  57. TYPE
  58. CMErr = OSErr;
  59.  
  60. CONST
  61.  
  62. { Low word of CMRecFlags is same as CMChannel }
  63. cmData = $00000001;
  64. cmCntl = $00000002;
  65. cmAttn = $00000004;
  66. cmDataNoTimeout = $00000010;
  67. cmCntlNoTimeout = $00000020;
  68. cmAttnNoTimeout = $00000040;
  69. cmDataClean = $00000100;
  70. cmCntlClean = $00000200;
  71. cmAttnClean = $00000400;
  72.  
  73. { only for CMRecFlags (not CMChannel) below this point }
  74. cmNoMenus = $00010000;
  75. cmQuiet = $00020000;
  76. cmConfigChanged = $00040000;
  77.  
  78. TYPE
  79. CMRecFlags = LONGINT;
  80.  
  81.  
  82. CMChannel = INTEGER;
  83.  
  84. CONST
  85.  
  86. { CMStatFlags }
  87. cmStatusOpening = $00000001;
  88. cmStatusOpen = $00000002;
  89. cmStatusClosing = $00000004;
  90. cmStatusDataAvail = $00000008;
  91. cmStatusCntlAvail = $00000010;
  92. cmStatusAttnAvail = $00000020;
  93. cmStatusDRPend = $00000040;        {data read pending}
  94. cmStatusDWPend = $00000080;        {data write pending}
  95. cmStatusCRPend = $00000100;        {cntl read pending}
  96. cmStatusCWPend = $00000200;        {cntl write pending}
  97. cmStatusARPend = $00000400;        {attn read pending}
  98. cmStatusAWPend = $00000800;        {attn write pending}
  99. cmStatusBreakPend = $00001000;
  100. cmStatusListenPend = $00002000;
  101. cmStatusIncomingCallPresent = $00004000;
  102. cmStatusReserved0 = $00008000;
  103.  
  104. TYPE
  105. CMStatFlags = LONGINT;
  106.  
  107. CMBufFields = (cmDataIn,cmDataOut,cmCntlIn,cmCntlOut,cmAttnIn,cmAttnOut,
  108.  cmRsrvIn,cmRsrvOut);
  109.  
  110.  
  111. CMBuffers = ARRAY[CMBufFields] OF Ptr;
  112. CMBufferSizes = ARRAY[CMBufFields] OF LONGINT;
  113.  
  114. CONST
  115.  
  116. { CMSearchFlags }
  117. cmSearchSevenBit = $0001;
  118.  
  119. TYPE
  120. CMSearchFlags = INTEGER;
  121.  
  122.  
  123. CONST
  124.  
  125. { CMFlags }
  126. cmFlagsEOM = $0001;
  127.  
  128. TYPE
  129. CMFlags = INTEGER;
  130.  
  131.  
  132. ConnEnvironRecPtr = ^ConnEnvironRec;
  133. ConnEnvironRec = RECORD
  134.  version: INTEGER;
  135.  baudRate: LONGINT;
  136.  dataBits: INTEGER;
  137.  channels: CMChannel;
  138.  swFlowControl: BOOLEAN;
  139.  hwFlowControl: BOOLEAN;
  140.  flags: CMFlags;
  141.  END;
  142.  
  143. ConnPtr = ^ConnRecord;
  144. ConnHandle = ^ConnPtr;
  145. ConnRecord = RECORD
  146.  procID: INTEGER;
  147.  flags: CMRecFlags;
  148.  errCode: CMErr;
  149.  refCon: LONGINT;
  150.  userData: LONGINT;
  151.  defProc: ProcPtr;
  152.  config: Ptr;
  153.  oldConfig: Ptr;
  154.  asyncEOM: LONGINT;
  155.  reserved1: LONGINT;
  156.  reserved2: LONGINT;
  157.  cmPrivate: Ptr;
  158.  bufferArray: CMBuffers;
  159.  bufSizes: CMBufferSizes;
  160.  mluField: LONGINT;
  161.  asyncCount: CMBufferSizes;
  162.  END;
  163.  
  164.  
  165. { application routines type definitions }
  166. ConnectionSearchCallBackProcPtr = ProcPtr;
  167. ConnectionCompletionProcPtr = ProcPtr;
  168. ConnectionChooseIdleProcPtr = ProcPtr;
  169.  
  170. CONST
  171.  
  172. { CMIOPB constants and structure }
  173. cmIOPBQType = 10;
  174. cmIOPBversion = 0;
  175.  
  176. TYPE
  177. CMIOPBPtr = ^CMIOPB;
  178. CMIOPB = RECORD
  179.  qLink: QElemPtr;
  180.  qType: INTEGER;                { cmIOPBQType }
  181.  hConn: ConnHandle;
  182.  theBuffer: Ptr;
  183.  count: LONGINT;
  184.  flags: CMFlags;
  185.  userCompletion: ConnectionCompletionProcPtr;
  186.  timeout: LONGINT;
  187.  errCode: CMErr;
  188.  channel: CMChannel;
  189.  asyncEOM: LONGINT;
  190.  reserved1: LONGINT;
  191.  reserved2: INTEGER;
  192.  version: INTEGER;                { cmIOPBversion }
  193.  refCon: LONGINT;                { for application }
  194.  toolData1: LONGINT;            { for tool }
  195.  toolData2: LONGINT;            { for tool }
  196.  END;
  197.  
  198.  
  199. FUNCTION InitCM: CMErr;
  200. FUNCTION CMGetVersion(hConn: ConnHandle): Handle;
  201. FUNCTION CMGetCMVersion: INTEGER;
  202.  
  203. FUNCTION CMNew(procID: INTEGER;flags: CMRecFlags;desiredSizes: CMBufferSizes;
  204.  refCon: LONGINT;userData: LONGINT): ConnHandle;
  205.  
  206. PROCEDURE CMDispose(hConn: ConnHandle);
  207.  
  208. FUNCTION CMListen(hConn: ConnHandle;async: BOOLEAN;completor: ConnectionCompletionProcPtr;
  209.  timeout: LONGINT): CMErr;
  210. FUNCTION CMAccept(hConn: ConnHandle;accept: BOOLEAN): CMErr;
  211.  
  212. FUNCTION CMOpen(hConn: ConnHandle;async: BOOLEAN;completor: ConnectionCompletionProcPtr;
  213.  timeout: LONGINT): CMErr;
  214. FUNCTION CMClose(hConn: ConnHandle;async: BOOLEAN;completor: ConnectionCompletionProcPtr;
  215.  timeout: LONGINT;now: BOOLEAN): CMErr;
  216.  
  217. FUNCTION CMAbort(hConn: ConnHandle): CMErr;
  218.  
  219. FUNCTION CMStatus(hConn: ConnHandle;VAR sizes: CMBufferSizes;VAR flags: CMStatFlags): CMErr;
  220. PROCEDURE CMIdle(hConn: ConnHandle);
  221.  
  222. PROCEDURE CMReset(hConn: ConnHandle);
  223.  
  224. PROCEDURE CMBreak(hConn: ConnHandle;duration: LONGINT;async: BOOLEAN;completor: ConnectionCompletionProcPtr);
  225.  
  226. FUNCTION CMRead(hConn: ConnHandle;theBuffer: Ptr;VAR toRead: LONGINT;theChannel: CMChannel;
  227.  async: BOOLEAN;completor: ConnectionCompletionProcPtr;timeout: LONGINT;
  228.  VAR flags: CMFlags): CMErr;
  229. FUNCTION CMWrite(hConn: ConnHandle;theBuffer: Ptr;VAR toWrite: LONGINT;
  230.  theChannel: CMChannel;async: BOOLEAN;completor: ConnectionCompletionProcPtr;
  231.  timeout: LONGINT;flags: CMFlags): CMErr;
  232.  
  233. FUNCTION CMIOKill(hConn: ConnHandle;which: INTEGER): CMErr;
  234.  
  235. PROCEDURE CMActivate(hConn: ConnHandle;activate: BOOLEAN);
  236. PROCEDURE CMResume(hConn: ConnHandle;resume: BOOLEAN);
  237. FUNCTION CMMenu(hConn: ConnHandle;menuID: INTEGER;item: INTEGER): BOOLEAN;
  238.  
  239. FUNCTION CMValidate(hConn: ConnHandle): BOOLEAN;
  240. PROCEDURE CMDefault(VAR theConfig: Ptr;procID: INTEGER;allocate: BOOLEAN);
  241.  
  242. FUNCTION CMSetupPreflight(procID: INTEGER;VAR magicCookie: LONGINT): Handle;
  243. FUNCTION CMSetupFilter(procID: INTEGER;theConfig: Ptr;count: INTEGER;theDialog: DialogPtr;
  244.  VAR theEvent: EventRecord;VAR theItem: INTEGER;VAR magicCookie: LONGINT): BOOLEAN;
  245. PROCEDURE CMSetupSetup(procID: INTEGER;theConfig: Ptr;count: INTEGER;theDialog: DialogPtr;
  246.  VAR magicCookie: LONGINT);
  247. PROCEDURE CMSetupItem(procID: INTEGER;theConfig: Ptr;count: INTEGER;theDialog: DialogPtr;
  248.  VAR theItem: INTEGER;VAR magicCookie: LONGINT);
  249. PROCEDURE CMSetupXCleanup(procID: INTEGER;theConfig: Ptr;count: INTEGER;
  250.  theDialog: DialogPtr;OKed: BOOLEAN;VAR magicCookie: LONGINT);
  251. PROCEDURE CMSetupPostflight(procID: INTEGER);
  252.  
  253. FUNCTION CMGetConfig(hConn: ConnHandle): Ptr;
  254. FUNCTION CMSetConfig(hConn: ConnHandle;thePtr: Ptr): INTEGER;
  255.  
  256. FUNCTION CMIntlToEnglish(hConn: ConnHandle;inputPtr: Ptr;VAR outputPtr: Ptr;
  257.  language: INTEGER): OSErr;
  258. FUNCTION CMEnglishToIntl(hConn: ConnHandle;inputPtr: Ptr;VAR outputPtr: Ptr;
  259.  language: INTEGER): OSErr;
  260.  
  261. FUNCTION CMAddSearch(hConn: ConnHandle;theString: Str255;flags: CMSearchFlags;
  262.  callBack: ConnectionSearchCallBackProcPtr): LONGINT;
  263. PROCEDURE CMRemoveSearch(hConn: ConnHandle;refnum: LONGINT);
  264. PROCEDURE CMClearSearch(hConn: ConnHandle);
  265.  
  266. FUNCTION CMGetConnEnvirons(hConn: ConnHandle;VAR theEnvirons: ConnEnvironRec): CMErr;
  267.  
  268. FUNCTION CMChoose(VAR hConn: ConnHandle;where: Point;idleProc: ConnectionChooseIdleProcPtr): INTEGER;
  269.  
  270. PROCEDURE CMEvent(hConn: ConnHandle;theEvent: EventRecord);
  271.  
  272. PROCEDURE CMGetToolName(procID: INTEGER;VAR name: Str255);
  273. FUNCTION CMGetProcID(name: Str255): INTEGER;
  274.  
  275. PROCEDURE CMSetRefCon(hConn: ConnHandle;refCon: LONGINT);
  276. FUNCTION CMGetRefCon(hConn: ConnHandle): LONGINT;
  277.  
  278. FUNCTION CMGetUserData(hConn: ConnHandle): LONGINT;
  279. PROCEDURE CMSetUserData(hConn: ConnHandle;userData: LONGINT);
  280.  
  281. PROCEDURE CMGetErrorString(hConn: ConnHandle;id: INTEGER;VAR errMsg: Str255);
  282.  
  283. FUNCTION CMNewIOPB(hConn: ConnHandle;VAR theIOPB: CMIOPBPtr): CMErr;
  284. FUNCTION CMDisposeIOPB(hConn: ConnHandle;theIOPB: CMIOPBPtr): CMErr;
  285.  
  286. FUNCTION CMPBRead(hConn: ConnHandle;theIOPB: CMIOPBPtr;async: BOOLEAN): CMErr;
  287. FUNCTION CMPBWrite(hConn: ConnHandle;theIOPB: CMIOPBPtr;async: BOOLEAN): CMErr;
  288. FUNCTION CMPBIOKill(hConn: ConnHandle;theIOPB: CMIOPBPtr): CMErr;
  289.  
  290.  
  291. {$ENDC} { UsingConnections }
  292.  
  293. {$IFC NOT UsingIncludes}
  294.  END.
  295. {$ENDC}
  296.  
  297.